//数组的课后练习

import java.util.Arrays;
import java.util.Scanner;

public class Test {
    //1.改变原有数组元素的值
    public static String tranForm(int[] array) {
        int[] copy = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            copy[i] = array[i] * 2;
        }
        String ret = Arrays.toString(copy);
        return ret;
    }

    public static void main1(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5};
        System.out.println(tranForm(array));
    }

    //2.求数组的平均值
    public static double avgs(int[] array) {
        int usm = 0;
        for (int i = 0; i < array.length; i++) {
            usm += array[i];
        }
        return usm * 1.0 / (double) array.length;
    }

    public static void main2(String[] args) {
        int[] array = new int[]{1, 2, 3, 4, 5};
        System.out.println(avgs(array));

    }

    //3.奇数位于偶数之前
    public static void sort(int[] array){
        for (int i = 0; i < array.length-1; i++) {
            if(array[i] % 2 == 0 && array[i+1] % 2 != 0){
                int temp = array[i];
                array[i] = array[i+1];
                array[i+1] = temp;
            }
            if(array[i] % 2 != 0 && array[i+1] % 2 != 0){
                break;
            }
        }
    }
    public static void main3(String[] args) {
        int[] array = new int[6];
        Scanner sc = new Scanner(System.in);
        for(int i = 0;i < array.length; i++){
            array[i] = sc.nextInt();
            System.out.print(array[i] + " ");
        }
        sc.close();
        System.out.println();
        sort(array);
        System.out.println(Arrays.toString(array));
    }
    //4.冒泡排序
    public static void bubbleSort (int[] array){
        //i表示的是趟数
        for (int i = 0; i < array.length-1; i++) {
            //j要代表每一趟比较的此次数
            boolean flg = false;
            for (int j = 0; j < array.length-1-i; j++) {
                //减i是有i个元素已经比较完成了，为了去掉一些不必要的次数。
                if(array[j] > array[j + 1]){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
            if( flg == true){
                break;//这时候说明了交换的是有序的
                //因为有时候某一趟的时候就已经有序了，这个时候为了减少不必要的交换；
                //所以我们可以用break来进行跳出
            }
        }
    }
    public static void main4(String[] args) {
        int[] array = new int[]{8,4,9,3,6};
        System.out.println(Arrays.toString(array));
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
//        for (int i = 0; i < array.length; i++) {
//            System.out.print(array[i] + " ");
//        }
    }


    public static boolean func(int[] array){
        for (int i = 0; i < array.length; i++) {
            if((array[i] %2 != 0) && (array[i+1] %2 != 0) && (array[i+3] %2 != 0) ){
                return true;
            }
            break;
        }
        return false;
    }
    public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }
        sc.close();
        boolean flg = func(array);
        System.out.println(flg);
    }
    //这种写法得到数组越界访问ArrayIndexOutOfBoundsException
